/*
 * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.inspur.edp.formserver.vmapi.dto;

import io.iec.edp.caf.securityentry.api.data.SecurityEntry;
import io.iec.edp.caf.securityentry.api.data.SecurityEntry4RuleDTO;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * 视图模型数据权限信息DTO
 * @author sunhongfei01
 * @since 2025-02-26
 */
@Getter
@Setter
@NoArgsConstructor
public class ViewModelAuthSecurityDto {
    // 是否使用规则权限
    private boolean permRule;
    // 普通数据权限
    private SecurityEntry authSecurityEntry;
    // 规则权限
    private SecurityEntry4RuleDTO permSecurityEntry;

    /**
     * 构造函数
     * @param securityEntry 数据权限
     * @param entry4RuleDTO 规则权限
     */
    public ViewModelAuthSecurityDto(SecurityEntry securityEntry, SecurityEntry4RuleDTO entry4RuleDTO) {
        this.authSecurityEntry = securityEntry;
        this.permSecurityEntry = entry4RuleDTO;
        // 是否使用规则权限: 如果规则权限不为空，则使用规则权限
        this.permRule = entry4RuleDTO != null;
    }
}
